# -*- coding: utf-8 -*-
# -*- frozen_string_literal: true -*-

class <%= @scaffold.main_namespace %>
<%= "  module " + @scaffold.plugin_namespace if @scaffold.plugin_namespace %>
  # Aimed at basic security auditing tools.
  module Manifest
    # Name as used in `require` statements.
    def self.gem_name
      "<%= @scaffold.gem_name %>"
    end

    # Name as it's meant to be spelled.
    def self.official_name
    "<%= @scaffold.formatted_name %>"
    end

    # Array of authors' string names
    def self.authors
    ["<%= @scaffold.author %>"].freeze
    end

    # Array of maintainers' email strings.
    def self.contact_emails
    %w[<%= @scaffold.email %>].freeze
    end

    # Main repo url.
    def self.repo
    "<%= @scaffold.repo %>"
    end

    # License type. Full text in License.md.
    def self.license
      "<%= @scaffold.license %>"
    end

# Online resources.
def self.metadata
# :TODO:
{
"source_code_uri"   => repo,
"bug_tracker_uri"   => "https://example.com/USERNAME/<%= @scaffold.gem_name %>/issues",
"changelog_uri"     => "https://example.com/USERNAME/<%= @scaffold.gem_name %>/src/master/ChangeLog.md"
}.freeze
end

# Array of official gem files. Manually maintained at Manifest.md.
#--
# Not frozen, raises warnings building gem.
#++
def self.files
File.readlines("./Manifest.md").map(&:strip).reject(&:empty?)
end

# Array of directories housing the codebase.
def self.codebase
      src = "lib"
      [src].freeze if files.any? { |f| f.start_with? "#{src}/" }
    end

    # Directory housing the test suite.
    def self.test_suite
      "test"
    end

    # Array of test files.
    def self.tests
tests = Dir["test/**/test_*.rb"] - Dir["test/dev/**/*.rb"]
tests.freeze
end

# Directory housing binstubs.
def self.bindir
"bin"
end
<% if @scaffold.bin %>

  # Array of binstubs.
  def self.binstubs
  %w[<%= @scaffold.gem_name %> <%= @scaffold.gem_name %>-alpine].freeze
  end
<% end %>
end
  <%= "  end" if @scaffold.plugin_namespace %>
end
